package ru.sazonov.ide.parser

import ru.sazonov.ide.parser.processor.AbstractProcessor
import ru.sazonov.ide.model.ModelPart
import org.springframework.stereotype.Component

class Parser {
    def List<AbstractProcessor> processors = [];

    def ModelPart parseFile(File f) {
        ModelPart result = new ModelPart();
        processors.each({
            result.join(it.process(f))
        });

        result;
    }

    def ModelPart parseDirectory(File f) {
        ModelPart result = new ModelPart();

        f.eachFileRecurse {
            result.join(parseFile(it));
        }
        return result;
    }
}
